﻿--Script to setup default fields and with format masks

DECLARE @DocumentTypeId as integer

This sytax error is here to remind you to setup the document types first and to change it for each document type in the marriage group.
--Set up all marriage related document types, then run this script for each type after changing the select statement below.
Select  @DocumentTypeId = [Id] from [DocumentType] where  [Code] = 'MarriageKiosk'


update [Setting] Set SettingValue="" WHERE SettingKey = 'PARENT/LEGAL GUARDIAN ONE (PADRE/TUTOR LEGAL QUIEN)' WHERE SettingKey = 'ParentLegalGuardianTitle1'
update [Setting] Set SettingValue="" WHERE SettingKey = 'PARENT/LEGAL GUARDIAN TWO (PADRE/TUTOR LEGAL DOS)' WHERE SettingKey = 'ParentLegalGuardianTitle2'

DECLARE @DocumentTypeId as integer
Select  @DocumentTypeId = [Id] from [DocumentType] where  [Code] = 'MarriageKiosk'
update  [DocumentTypeField] set [prompt] = REPLACE([prompt],' 1 ',' One ') where  [DocumentTypeId] = @DocumentTypeId
update  [DocumentTypeField] set [prompt] = REPLACE([prompt],' 2 ',' Two ') where  [DocumentTypeId] = @DocumentTypeId
update  [DocumentTypeField] set [prompt] = REPLACE([prompt],'1 ','One ') where  [DocumentTypeId] = @DocumentTypeId
update  [DocumentTypeField] set [prompt] = REPLACE([prompt],'2 ','Two ') where  [DocumentTypeId] = @DocumentTypeId

DECLARE @DefaultComboValue as varchar(100)
Set @DefaultComboValue = '--Select One--'

--Gender Updates
DECLARE @Genders as varchar(1000)
Set @Genders = '{ComboList}|Female|Male'
update [DocumentTypeField] SET ComboList = @Genders, DefaultValue = @DefaultComboValue where [FieldName] ='GroomGender' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET ComboList = @Genders, DefaultValue = @DefaultComboValue where [FieldName] ='BrideGender' and [DocumentTypeId] = @DocumentTypeId

--Ceremony Date
DECLARE @CeremonTypes as varchar(1000)
Set @CeremonTypes = '{ComboList}|Religious|Civil|Self'
update [DocumentTypeField] SET ComboList = @CeremonTypes, DefaultValue = @CeremonTypes where [FieldName] ='CeremonyType' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET ComboList = @Genders, DefaultValue = @Genders where [FieldName] ='BrideGender' and [DocumentTypeId] = @DocumentTypeId

--PresentMaritalStatus
DECLARE @PresentMaritalStatus as varchar(1000)
Set @PresentMaritalStatus = '{ComboList}|Single|Widowed|Divorced/Dissolved|Married|Civil Union'
update [DocumentTypeField] SET ComboList = @PresentMaritalStatus, DefaultValue = @PresentMaritalStatus where [FieldName] ='BridePresentMaritalStatus' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET ComboList = @PresentMaritalStatus, DefaultValue = @PresentMaritalStatus where [FieldName] ='GroomPresentMaritalStatus' and [DocumentTypeId] = @DocumentTypeId

--PresentMaritalStatus
DECLARE @ProofOfAge as varchar(1000)
Set @ProofOfAge = '{ComboList}|Valid Drivers License|Passport|Birth Certificate|Other (specify)'
update [DocumentTypeField] SET ComboList = @ProofOfAge, DefaultValue = @ProofOfAge where [FieldName] ='BrideProofOfAge' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET ComboList = @ProofOfAge, DefaultValue = @ProofOfAge where [FieldName] ='GroomProofOfAge' and [DocumentTypeId] = @DocumentTypeId

--date masks
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField1' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField5' and [DocumentTypeId] = @DocumentTypeId

update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField6' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='GroomDivorcedWidowedDate' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='GroomDatePreviousMarriageEnded' and [DocumentTypeId] = @DocumentTypeId

update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField2' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='BrideDOB' and [DocumentTypeId] = @DocumentTypeId

update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField7' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='BrideDatePreviousMarriageEnded' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='BrideDivorcedWidowedDate' and [DocumentTypeId] = @DocumentTypeId

update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField3' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField4' and [DocumentTypeId] = @DocumentTypeId
update [DocumentTypeField] SET FormatMask = '**/**/****' where [FieldName] ='DateField5' and [DocumentTypeId] = @DocumentTypeId


